In the code shown below, which function is the decorator? def mk(x): def mk1(): print("Decorated") x() return mk1 def mk2(): print("Ordinary") p = mk(mk2) p()
1.p()
2. mk1()
3. mk1()
4.mk2()
Posted Date:-2022-02-11 11:38:58
Is the following piece of code valid? a=2,3,4,5 a
1.Yes, 2 is printed
2.Yes, [2,3,4,5] is printed
3.No, too many values to unpack
4.Yes, (2,3,4,5) is printed
Posted Date:-2022-02-11 12:12:29
The output of the two codes shown below is the same. State whether this statement is true or false. bin((2**16)-1) '{}'.format(bin((2**16)-1))
1.True
2.False
3. Both I and II
4. Only I
Posted Date:-2022-02-11 11:36:50
What dataype is the object below ? L = [1, 23, 'hello', 1].
1. list
2.dictionary
3.array
4.tuple
Posted Date:-2022-02-11 11:29:26
What is answer of this expression, 22 % 3 is?
1.7
2.1
3.0
4.5
Posted Date:-2022-02-11 11:22:42
What is the output of the code shown below? def d(f): def n(*args): return '$' + str(f(*args)) return n @d def p(a, t): return a + a*t print(p(100,0))
1. 100
2.$100
3. $0
4. 0
Posted Date:-2022-02-11 11:46:41
What is the output of the code shown below? def f1(): x=100 print(x) x=+1 f1() A.
1.Error
2.100
3.101
4.91
Posted Date:-2022-02-11 13:09:04
What is the output of the code shown below? s=set([1, 2, 3]) s.union([4, 5]) s|([4, 5])
1.{1, 2, 3, 4, 5}{1, 2, 3, 4, 5}
2.Error{1, 2, 3, 4, 5}
3. {1, 2, 3, 4, 5}Error
4.ErrorError
Posted Date:-2022-02-11 12:05:05
What is the output of the following code? a,b=6,7 a,b=b,a a,b
1.6,7)
2.Invalid syntax
3.(7,6)
4.Nothing is printed
Posted Date:-2022-02-11 12:15:16
What is the output of the following piece of code when executed in Python shell? a=("Check")*3 a
1.('Check','Check','Check')
2. Operator not valid for tuples
3.('CheckCheckCheck')
4.Syntax error
Posted Date:-2022-02-11 12:10:44
What is the output of the following piece of code when executed in the python shell? a={1,2,3} a.intersection_update({2,3,4,5}) a
1.{2,3}
2. Error, duplicate item present in list
3. Error, no method called intersection_update for set data type
4. {1,4,5}
Posted Date:-2022-02-11 12:02:23
What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for x in d.values(): print(x)
1.0 1 2
2. 0 a 1 b 2 c
3. 0 a 1 b 2 c
4.none of the mentioned
Posted Date:-2022-02-11 13:52:38
What is the output of the following? print('*', "abcdef".center(7), '*')
1.* abcdef *
2.* abcdef *
3.*abcdef *
4. * abcdef*
Posted Date:-2022-02-11 11:51:11
What is the output of the following? print('1.1'.isnumeric())
1.True
2.False
3.None
4.Error
Posted Date:-2022-02-11 11:55:54
What is the output of the following? print('ab'.isalpha())
1.True
2.False
3.None
4.Error
Posted Date:-2022-02-11 11:54:40
What is the output of the following? print("xyyzxyzxzxyy".count('xyy', 2, 11))
1.2
2.0
3.1
4.Error
Posted Date:-2022-02-11 11:51:59
What is the result of the expression if x=15 and y=12:
1.b1101
2.0b1101
3.12
4.1101
Posted Date:-2022-02-11 13:31:47
. What is the output of the following? for i in range(float('inf')): print (i)
1.0.0 0.1 0.2 0.3
2.0 1 2 3
3.0.0 1.0 2.0 3.0
4.none of the mentioned
Posted Date:-2022-02-11 13:54:08
. What is the output of the following? print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))
1.abcd
2.1234
3.error
4. none of the mentioned
Posted Date:-2022-02-11 11:59:13
. Which of these is false about recursion?
1.Recursive function can be replaced by a non-recursive function
2.Recursive functions usually take more memory space than non-recursive function
3.Recursive functions run faster than non-recursive function
4.Recursion makes programs easier to understand
Posted Date:-2022-02-11 13:14:40
All keywords in Python are in
1.lower case
2.UPPER CASE
3.Capitalized
4.None of the mentioned
Posted Date:-2022-02-11 11:33:41
h of the following formatting options can be used in order to add 'n' blank spaces after a given string 'S'?
1.print(-ns"Â%S)
2.print(-ns"Â%S)
3.print(%ns"Â%S)
4.print(%-ns"Â%S)
Posted Date:-2022-02-11 11:43:32
How many keyword arguments can be passed to a function in a single function call?
1.zero
2.one
3.zero or more
4.one or more
Posted Date:-2022-02-11 13:01:42
On assigning a value to a variable inside a function, it automatically becomes a global variable. State whether true or false.
1.True
2.False
3.Error
4.Not mentioned
Posted Date:-2022-02-11 13:10:34
The output of the code shown below is: int('65.43')
1.ImportError
2.ValueError
3.TypeError
4.NameError
Posted Date:-2022-02-11 13:25:01
The output of the code shown below is: s='{0}, {1}, and {2}' s.format('hello', 'good', 'morning')
1.hello good and morning'
2.'hello, good, morning
3.'hello, good, and morning'
4.Error
Posted Date:-2022-02-11 11:45:38
What are the methods which begin and end with two underscore characters called?
1.Special methods
2.In-built methods
3.User-defined methods
4.Additional methods
Posted Date:-2022-02-11 13:20:26
What does --------- 5 evaluate to?
1.+5
2.-11
3.+11
4.-5
Posted Date:-2022-02-11 11:30:11
What is the maximum possible length of an identifier?
1.31 characters
2.63 characters
3. 79 characters
4.none of the mentioned
Posted Date:-2022-02-11 11:32:39
What is the output of "helloÂ+1+2+3 ?
1. hello123
2.hello
3. Error
4.hello6
Posted Date:-2022-02-11 11:49:46
What is the output of the code shown below? 'The {} side {1} {2}'.format('bright', 'of', 'life')
1.Error
2.'The bright side of life
3.The {bright} side {of} {life}
4.No output
Posted Date:-2022-02-11 11:37:49
What is the output of the code shown below? class Truth: pass x=Truth() bool(x)
1.pass
2.true
3.false
4.error
Posted Date:-2022-02-11 13:36:29
What is the output of the code shown below? def f(x): def f1(a, b): print("hello") if b==0: print("NO") return return f(a, b) return f1 @f def f(a, b): return a%b f(4,0)
1.helloNO
2. helloZero Division Error
3.NO
4.hello
Posted Date:-2022-02-11 11:39:57
What is the output of the code shown below? def f(x): yield x+1 print("test") yield x+2 g=f(9)
1.Error
2.test
3. test1012
4.No output
Posted Date:-2022-02-11 13:23:42
What is the output of the code shown below? def mk(x): def mk1(): print("Decorated") x() return mk1 def mk2(): print("Ordinary") p = mk(mk2) p()
1.DecoratedDecorated
2.OrdinaryOrdinary
3.OrdinaryDecorated
4. DecoratedOrdinary
Posted Date:-2022-02-11 11:41:02
What is the output of the code shown below? l1=[1, 2, 3, [4]] l2=list(l1) id(l1)==id(l2)
1.True
2.False
3.Error
4.Address of l1
Posted Date:-2022-02-11 13:16:16
What is the output of the code shown below? not(3>4) not(1&1)
1.TrueTrue
2. TrueFalse
3.FalseTrue
4.FalseFalse
Posted Date:-2022-02-11 13:35:26
What is the output of the code shown? x=3.3456789 '%f | %e | %g' %(x, x, x)
1.Error
2. '3.3456789 | 3.3456789+00 | 3.345678
3.'3.345678 | 3.345678e+0 | 3.345678'
4. '3.345679 | 3.345679e+00 | 3.34568'
Posted Date:-2022-02-11 11:44:47
What is the output of the following code ? example = "snow world" example[3] = 's' print example
1.snow
2.snow world
3.Error
4.snos world
Posted Date:-2022-02-11 11:49:09
What is the output of the following piece of code? class A(): def disp(self): print("A disp()") class B(A): pass obj = B() obj.disp()
1. Invalid syntax for inheritance
2.Error because when object is created, argument must be passed
3.Nothing is printed
4.A disp()
Posted Date:-2022-02-11 13:26:20
What is the output of the following piece of code? class Demo: def __init__(self): self.x = 1 def change(self): self.x = 10 class Demo_derived(Demo): def change(self): self.x=self.x+1 return self.x def main(): obj = Demo_derived() print(obj.change()) main()
1.11
2.2
3.1
4.An exception is thrown
Posted Date:-2022-02-11 13:28:38
What is the output of the following? a = [0, 1, 2, 3] for a[0] in a: print(a[0])
1.0 1 2 3
2.0 1 2 2
3.3 3 3 3
4.error
Posted Date:-2022-02-11 13:56:35
What is the output of the following? i = 2 while True: if i%3 == 0: break print(i) i += 2
1.i i i i i i
2. a a a a a a
3. a a a a a
4.none of the mentioned
Posted Date:-2022-02-11 13:43:27
What is the output of the following? print('a'.maketrans('ABC', '123'))
1.{97: 49, 98: 50, 99: 51}
2.{65: 49, 66: 50, 67: 51}
3. {97: 49}
4.1
Posted Date:-2022-02-11 11:56:59
What is the output of the following? print('The sum of {0} and {1} is {2}'.format(2, 10, 12))
1.The sum of 2 and 10 is 12
2.Error
3.The sum of 0 and 1 is 2
4.None of the mentioned
Posted Date:-2022-02-11 11:53:55
What is the output of the following? print('xyyxyyxyxyxxy'.replace('xy', '12', 100))
1.xyyxyyxyxyxxy
2.12y12y1212x12
3.none of the mentioned
4.Error
Posted Date:-2022-02-11 11:58:19
What is the output of the following? print("Hello {1} and {0}".format('bin', 'foo'))
1.Hello foo and bin
2.Hello bin and foo
3.Error
4.None of the mentioned
Posted Date:-2022-02-11 11:52:48
What is the output of the following? string = "my name is x" for i in string.split(): print (i, end=", ")
1.m, y, , n, a, m, e, , i, s, , x,
2.m, y, , n, a, m, e, , i, s, , x
3.my, name, is,
4.error
Posted Date:-2022-02-11 13:55:25
What is the output of the following? x = 'abcd' for i in range(len(x)): x[i].upper() print (x)
1.abcd
2.ABCD
3.error
4.none of the mentioned
Posted Date:-2022-02-11 13:49:11
What is the output of the following? x = 'abcd' for i in x: print(i.upper())
1.a b c d
2. A B C D
3.a B C D
4.error
Posted Date:-2022-02-11 13:48:11
What is the output of the following? x = "abcdef" i = "i" while i in x: print(i, end=" ")
1.no output
2. i i i i i i "
3.a b c d e f
4. abcdef
Posted Date:-2022-02-11 13:45:25
What is the output of the line of code shown below, if s1= {1, 2, 3}? s1.issubset(s1)
1.True
2.Error
3.No output
4.False
Posted Date:-2022-02-11 12:05:46
What is the output of this expression, 3*1**3?
1.27
2.9
3.3
4.1
Posted Date:-2022-02-11 11:23:10
What is the output when following code is executed ? print r" hello" The output is
1.a new line and hello
2. hello
3.the letter r and then hello
4.Error
Posted Date:-2022-02-11 11:48:19
What is the result of round(0.5) “ round(-0.5)?
1.1.0
2.2.0
3.0.0
4.None of the mentioned
Posted Date:-2022-02-11 11:31:47
What is the result of the expression shown below if x=56.236? print("%.2f"%x)
1.56.00
2. 56.24
3.. 56.23
4.0056.236
Posted Date:-2022-02-11 11:42:22
What is the two's complement of -44?
1.1011011
2. 11010100
3.11101011
4.10110011
Posted Date:-2022-02-11 13:34:15
What is the value of the expression: 4+2**5//10
1.3
2.7
3.77
4. 0
Posted Date:-2022-02-11 13:39:11
What is the value of the following expression: 24//6%3, 24//4//2
1.(1,3)
2.(0,3)
3.(1,0)
4. (3,1)
Posted Date:-2022-02-11 13:40:17
What is the value of this expression: bin(10-2)+bin(12^4)
1.0b10000
2.0b10001000
3.0b1000b1000
4. 0b10000b1000
Posted Date:-2022-02-11 13:32:38
What is the value of x if: x = int(43.55+2/2)
1.43
2.44
3.22
4.23
Posted Date:-2022-02-11 13:38:20
What will be the output? d = {"john":40, "peter":45} d["john"]
1.40
2.45
3.john
4.peter"Â
Posted Date:-2022-02-11 12:09:37
Which of the following is an invalid statement?
1. abc = 1,000,000
2.a b c = 1000 2000 3000
3.a,b,c = 1000, 2000, 3000
4.a_b_c = 1,000,000
Posted Date:-2022-02-11 11:34:44
Which of the following lines of code will result in an error?
1. s={abs}
2. s={4, 'abc', (1,2)}
3.s={2, 2.2, 3, 'xyz'}
4.s={san}
Posted Date:-2022-02-11 12:03:11
Which of the following will run without errors ?
1.round(45.8)
2.round(6352.898,2,5)
3.round()
4.round(7463.123,2,1)
Posted Date:-2022-02-11 11:24:00
Which of these in not a core datatype?
1.Lists
2.Dictionary
3.Tuples
4.Class
Posted Date:-2022-02-11 11:35:26